/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "AULA_OCUPADA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AulaOcupada.findAll", query = "SELECT a FROM AulaOcupada a"),
    @NamedQuery(name = "AulaOcupada.findByAulCod", query = "SELECT a FROM AulaOcupada a WHERE a.aulaOcupadaPK.aulCod = :aulCod"),
    @NamedQuery(name = "AulaOcupada.findByAuldFech", query = "SELECT a FROM AulaOcupada a WHERE a.aulaOcupadaPK.auldFech = :auldFech"),
    @NamedQuery(name = "AulaOcupada.findByAuldIni", query = "SELECT a FROM AulaOcupada a WHERE a.auldIni = :auldIni"),
    @NamedQuery(name = "AulaOcupada.findByAuldFin", query = "SELECT a FROM AulaOcupada a WHERE a.auldFin = :auldFin"),
    @NamedQuery(name = "AulaOcupada.findByAuloMot", query = "SELECT a FROM AulaOcupada a WHERE a.auloMot = :auloMot")})
public class AulaOcupada implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AulaOcupadaPK aulaOcupadaPK;
    @Column(name = "AULD_INI")
    @Temporal(TemporalType.TIME)
    private Date auldIni;
    @Column(name = "AULD_FIN")
    @Temporal(TemporalType.TIME)
    private Date auldFin;
    @Column(name = "AULO_MOT")
    private String auloMot;
    @JoinColumn(name = "AUL_COD", referencedColumnName = "AUL_COD", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Aula aula;

    public AulaOcupada() {
    }

    public AulaOcupada(AulaOcupadaPK aulaOcupadaPK) {
        this.aulaOcupadaPK = aulaOcupadaPK;
    }

    public AulaOcupada(int aulCod, Date auldFech) {
        this.aulaOcupadaPK = new AulaOcupadaPK(aulCod, auldFech);
    }

    public AulaOcupadaPK getAulaOcupadaPK() {
        return aulaOcupadaPK;
    }

    public void setAulaOcupadaPK(AulaOcupadaPK aulaOcupadaPK) {
        this.aulaOcupadaPK = aulaOcupadaPK;
    }

    public Date getAuldIni() {
        return auldIni;
    }

    public void setAuldIni(Date auldIni) {
        this.auldIni = auldIni;
    }

    public Date getAuldFin() {
        return auldFin;
    }

    public void setAuldFin(Date auldFin) {
        this.auldFin = auldFin;
    }

    public String getAuloMot() {
        return auloMot;
    }

    public void setAuloMot(String auloMot) {
        this.auloMot = auloMot;
    }

    public Aula getAula() {
        return aula;
    }

    public void setAula(Aula aula) {
        this.aula = aula;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (aulaOcupadaPK != null ? aulaOcupadaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AulaOcupada)) {
            return false;
        }
        AulaOcupada other = (AulaOcupada) object;
        if ((this.aulaOcupadaPK == null && other.aulaOcupadaPK != null) || (this.aulaOcupadaPK != null && !this.aulaOcupadaPK.equals(other.aulaOcupadaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.AulaOcupada[ aulaOcupadaPK=" + aulaOcupadaPK + " ]";
    }
    
}
